<template>
  <view class="container">
    <view class="title">只能添加当前家庭的设备 </view>

    <view class="common_cell">
      <u-cell-group :border="false">
        <u-cell
          @click="toConfig"
          title="温控器"
          isLink
          label="设备编号：0234321321"
        />
      </u-cell-group>
    </view>

    <!-- <stateConfig ref="stateConfigRef" @confirm="confirm" /> -->
  </view>
</template>
  
  <script>
// import stateConfig from "./stateConfig";
export default {
  components: {
    // stateConfig,
  },
  data() {
    return {
      // 页面参数
      options: {},
      // 当前开关类型
      type: "",
      // 选中的设备名
      deviceName: "",
      // 设备id
      deviceId: "",
    };
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {},

  onUnload() {},

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {},

  methods: {
    confirm(_values) {
      console.log(_values);
    },
    toConfig() {
      this.deviceId = "0234321321";
      this.deviceName = "温控器";
      const app = this;
      uni.navigateTo({
        url: "/pages/automationConfig/stateChange/stateConfig/index",
        events: {
          statusChange: function (_data) {
            const eventChannel = app.getOpenerEventChannel();
            eventChannel.emit("deviceStatusChange", {
              type: _data,
              deviceName: app.deviceName,
              deviceId: app.deviceId,
            });
          },
          
        },
      });
    },
  },
};
</script>
  
  <style lang="scss" scoped>
.container {
  background: #f6f7fb;

  padding: 17.045rpx 42.614rpx 0px 42.614rpx;

  .title {
    color: rgba(0, 0, 0, 0.5);
    font-family: "Microsoft YaHei";
    font-size: 25.568rpx;
    font-weight: 400;
    line-height: 33.75rpx;
    text-align: left;
    margin-left: 17.045rpx;
  }
}
</style>
  